#pragma once
#include "ThreadSafer.h"
#include "NetMessage.h"
#include <list>
using namespace std;

namespace _FOGGE_
{
	namespace _NET_
	{

		class ReliableInQueue 
			: public _FOGGE_::_THREAD_::ThreadSafer
		{
		protected:
			list<UDPNetMessage *> m_MessagesOrdered;
			list<UDPNetMessage *> m_MessagesUnordered;
			DWORD               m_dwCurrentPacketID,
				m_dwCount,  // number of messages added to this queue.
				m_dwLastID;
			
		public:
			ReliableInQueue();
			virtual ~ReliableInQueue();
			
			void        Clear();
			void        AddMessage( UDPNetMessage * ptrMessage);
			UDPNetMessage *GetMessage();
			bool        UnorderedMessageIsQueued( DWORD msgID );
			DWORD       GetHighestID();
		    
			int         getOrderedMessageCount()     { return m_MessagesOrdered.size(); }
			int         getUnorderedMessageCount()   { return m_MessagesUnordered.size(); }
			int         getLastID() { return m_dwLastID ; }
			
			inline DWORD GetCurrentID() { return m_dwCurrentPacketID; }
			DWORD GetCount()			{ return m_dwCount;			}
		};
	}
}
